<%@tag pageEncoding="UTF-8" description="HTML 编辑器控件"%>
<%@attribute name="name"		required="true"  description="表单 name，字段名"%>
<%@attribute name="iframePath"	required="false" description="指定 iframe src 路径"%>
<%@attribute name="basePath" 	required="false" description="指定 iframe src 静态资源的路径"%>
<%@attribute name="isSimple"	required="false" description="是否需要转义 textarea"%>
<%@attribute name="openUploaderByGallery" type="java.lang.Boolean"	required="false" description="是否从画册里选择图片，而不是 FSO 系统"%>
<%--
    	<script>
	    	seajs.use('bigfoot/widget/htmlEditor', function(_htmlEditor){
	    		bf.htmlEditor = _htmlEditor; // 单例
	    		_htmlEditor.el = document.querySelector('.htmlEditor');
	    		_htmlEditor.init();
	    		_htmlEditor.setValue(''); 
	    	});
    	</script>
--%>
<%
	// 图标保存位置
	String assetPath = "http://vps.ajaxjs.com:8080/bigfoot/asset/UI/htmlEditor";
%>
<!-- HTML 编辑器控件 -->
<div class="htmlEditor">
	<ul class="toolbar">
		<li class="dorpdown">
			<img title="字体" src="<%=assetPath%>/4.gif" />
			<div class="fontfamilyChoser">
				<a href="javascript:;" style="font-family: '宋体'">宋体</a>
				<a href="javascript:;" style="font-family: '黑体'">黑体</a>
				<a href="javascript:;" style="font-family: '楷体'">楷体</a>
				<a href="javascript:;" style="font-family: '隶书'">隶书</a>
				<a href="javascript:;" style="font-family: '幼圆'">幼圆</a>
				<a href="javascript:;" style="font-family: 'Microsoft YaHei'">Microsoft YaHei</a>
				<a href="javascript:;" style="font-family: Arial">Arial</a>
				<a href="javascript:;" style="font-family: 'Arial Narrow'">Arial Narrow</a>
				<a href="javascript:;" style="font-family: 'Arial Black'">Arial Black</a>
				<a href="javascript:;" style="font-family: 'Comic Sans MS'">Comic Sans MS</a>
				<a href="javascript:;" style="font-family: Courier">Courier</a>
				<a href="javascript:;" style="font-family: System">System</a>
				<a href="javascript:;" style="font-family: 'Times New Roman'">Times New Roman</a>
				<a href="javascript:;" style="font-family: Verdana">Verdana</a>
			</div>
		</li>		
		<li class="dorpdown">
			<img title="字号" src="<%=assetPath%>/5.gif" />
			<div class="fontsizeChoser">
				<a href="javascript:;" style="font-size: xx-small; line-height: 120%">极小</a>
				<a href="javascript:;" style="font-size: x-small;  line-height: 120%">特小</a>
				<a href="javascript:;" style="font-size: small;    line-height: 120%">小</a>
				<a href="javascript:;" style="font-size: medium;   line-height: 120%">中</a>
				<a href="javascript:;" style="font-size: large;    line-height: 120%">大</a>
				<a href="javascript:;" style="font-size: x-large;  line-height: 120%">特大</a>
				<a href="javascript:;" style="font-size: xx-large; line-height: 140%">极大</a>
			</div>
		</li>		
	
		<li><img title="加粗"   onClick="bf.htmlEditor.format('Bold');" src="<%=assetPath%>/6.gif" /></li>		
		<li><img title="斜体"   onClick="bf.htmlEditor.format('Italic');" src="<%=assetPath%>/7.gif" /></li>		
		<li><img title="下划线"  onClick="bf.htmlEditor.format('Underline');" src="<%=assetPath%>/8.gif" /></li>
		<li><img title="左对齐"  onClick="bf.htmlEditor.format('Justifyleft');" src="<%=assetPath%>/9.gif" /></li>
		<li><img title="中间对齐" onClick="bf.htmlEditor.format('Justifycenter');" src="<%=assetPath%>/10.gif" /></li>
		<li><img title="右对齐"  onClick="bf.htmlEditor.format('Justifyright');" src="<%=assetPath%>/11.gif" /></li>
		<li><img title="数字编号" onClick="bf.htmlEditor.format('Insertorderedlist');" src="<%=assetPath%>/12.gif" /></li>
		<li><img title="项目编号" onClick="bf.htmlEditor.format('Insertunorderedlist');" src="<%=assetPath%>/13.gif" /></li>
		<li><img title="增加缩进" onClick="bf.htmlEditor.format('Outdent');" src="<%=assetPath%>/14.gif" /></li>
		<li><img title="减少缩进" onClick="bf.htmlEditor.format('Indent');" src="<%=assetPath%>/15.gif" /></li>
		<li><img title="字体颜色" onclick="foreColor(event);" src="<%=assetPath%>/16.gif" /></li>
		<li><img title="背景颜色" onclick="backColor(event);" src="<%=assetPath%>/17.gif" /></li>
		<li><img title="增加链接" onclick="bf.htmlEditor.createLink();" src="<%=assetPath%>/18.gif" /></li>
		<%
		if(openUploaderByGallery!=null && openUploaderByGallery){
		
		%>
		<li><img title="文件上传" onclick="bf.htmlEditor.openUploaderByGallery();" src="<%=assetPath%>/19.gif" /></li>
		<%}else{
		%>
		<li><img title="文件上传" onclick="bf.htmlEditor.openUploader();" src="<%=assetPath%>/19.gif" /></li>	
<%} %>
<%-- 		<li><img title="增加图片" onclick="bf.htmlEditor.createImg();" src="<%=assetPath%>/19.gif" /></li> --%>
		<li>
			<label>
				<input onClick="bf.htmlEditor.setMode(this.checked);" type="checkbox" name="switchMode" />HTML
			</label>
		</li>
	</ul>

	<div class="editorBody">
		<div> 
<!-- 			<iframe src="about:blank" designMode="on"></iframe> -->
			<iframe src="${iframePath}blankpage.jsp?basePath=${basePath}" designMode="on"></iframe>
		</div>

		<%if(isSimple != null && isSimple.equals("true")){%>
		<textarea style="height: 282px; width: 100%; display: none" name="${name}">
			<jsp:doBody />
		</textarea>
		 <%}else{%>
		<__textarea__ style="height: 282px; width: 100%; display: none" name="${name}">
		</__textarea__>
		<%}%>
	</div>
</div>
<!-- // HTML 编辑器控件 -->

<%--
保存为 blankpage.jsp 文件放在同级目录下
<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html>
	<head>
		<meta http-equiv="content-type" content="text/html; charset=utf-8">
		<title>New Document</title>
		<style type="text/css">
			body {
				font-size: 12px;
				padding-top: 3px;
				padding-left: 3px;
				padding-right: 0px;
				margin: 0px
			}
			
			p {
				margin: 0;
				padding: 0;
			}
		</style>
		<base href="${param.basePath}/" />
	</head>
	<body></body>
</html>
--%>